<!doctype html>
<html class="no-js">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1" charset="UTF-8">
    <title>inTopLevelTransaction</title>
<link href="../../images/logo-icon.svg" rel="icon" type="image/svg">    <script>var pathToRoot = "../../";</script>
    <script>document.documentElement.classList.replace("no-js","js");</script>
    <script>const storage = localStorage.getItem("dokka-dark-mode")
    if (storage == null) {
        const osDarkSchemePreferred = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
        if (osDarkSchemePreferred === true) {
            document.getElementsByTagName("html")[0].classList.add("theme-dark")
        }
    } else {
        const savedDarkMode = JSON.parse(storage)
        if(savedDarkMode === true) {
            document.getElementsByTagName("html")[0].classList.add("theme-dark")
        }
    }
    </script>
<script type="text/javascript" src="https://unpkg.com/kotlin-playground@1/dist/playground.min.js" async></script>
<script type="text/javascript" src="../../scripts/sourceset_dependencies.js" async></script>
<link href="../../styles/style.css" rel="Stylesheet">
<link href="../../styles/main.css" rel="Stylesheet">
<link href="../../styles/prism.css" rel="Stylesheet">
<link href="../../styles/logo-styles.css" rel="Stylesheet">
<link href="../../styles/font-jb-sans-auto.css" rel="Stylesheet">
<script type="text/javascript" src="../../scripts/clipboard.js" async></script>
<script type="text/javascript" src="../../scripts/navigation-loader.js" async></script>
<script type="text/javascript" src="../../scripts/platform-content-handler.js" async></script>
<script type="text/javascript" src="../../scripts/main.js" defer></script>
<script type="text/javascript" src="../../scripts/prism.js" async></script>
<script type="text/javascript" src="../../scripts/symbol-parameters-wrapper_deferred.js" defer></script></head>
<body>
    <div class="root">
<nav class="navigation" id="navigation-wrapper">
    <div class="navigation--inner">
        <div class="navigation-title">
            <button class="menu-toggle" id="menu-toggle" type="button">toggle menu</button>
            <div class="library-name">
<a class="library-name--link" href="../../index.html">
                            exposed
                    </a>            </div>
            <div class="library-version">0.57.0
            </div>
        </div>
        <div class="filter-section" id="filter-section">
                <button class="platform-tag platform-selector jvm-like" data-active="" data-filter=":exposed-core:dokkaHtmlPartial/main">jvm</button>
        </div>
    </div>
    <div class="navigation-controls">
        <button class="navigation-controls--btn navigation-controls--theme" id="theme-toggle-button" type="button">switch theme</button>
        <div class="navigation-controls--btn navigation-controls--search" id="searchBar" role="button">search in API</div>
    </div>
</nav>
        <div id="container">
            <div class="sidebar" id="leftColumn">
                <div class="sidebar--inner" id="sideMenu"></div>
            </div>
            <div id="main">
<div class="main-content" data-page-type="member" id="content" pageids="exposed-core::org.jetbrains.exposed.sql.transactions//inTopLevelTransaction/#kotlin.Int#kotlin.Boolean#org.jetbrains.exposed.sql.Database?#org.jetbrains.exposed.sql.Transaction?#kotlin.Function1[org.jetbrains.exposed.sql.Transaction,TypeParam(bounds=[kotlin.Any?])]/PointingToDeclaration//-1583301284">
  <div class="breadcrumbs"><a href="../index.html">exposed-core</a><span class="delimiter">/</span><a href="index.html">org.jetbrains.exposed.sql.transactions</a><span class="delimiter">/</span><span class="current">inTopLevelTransaction</span></div>
  <div class="cover ">
    <h1 class="cover"><span>in</span><wbr><span>Top</span><wbr><span>Level</span><wbr><span><span>Transaction</span></span></h1>
  </div>
  <div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-dependent-content" data-active="" data-togglable=":exposed-core:dokkaHtmlPartial/main"><div class="symbol monospace"><span class="token keyword">fun </span><span class="token operator">&lt;</span><a href="in-top-level-transaction.html">T</a><span class="token operator">&gt; </span><a href="in-top-level-transaction.html"><span class="token function">inTopLevelTransaction</span></a><span class="token punctuation">(</span><span class="parameters "><span class="parameter ">transactionIsolation<span class="token operator">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a><span class="token punctuation">, </span></span><span class="parameter ">readOnly<span class="token operator">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a><span class="token operator"> = </span><span class="token boolean">false</span><span class="token punctuation">, </span></span><span class="parameter ">db<span class="token operator">: </span><a href="../org.jetbrains.exposed.sql/-database/index.html">Database</a><span class="token operator">?</span><span class="token operator"> = </span>null<span class="token punctuation">, </span></span><span class="parameter ">outerTransaction<span class="token operator">: </span><a href="../org.jetbrains.exposed.sql/-transaction/index.html">Transaction</a><span class="token operator">?</span><span class="token operator"> = </span>null<span class="token punctuation">, </span></span><span class="parameter ">statement<span class="token operator">: </span><a href="../org.jetbrains.exposed.sql/-transaction/index.html">Transaction</a><span class="token punctuation">.</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator"> -&gt; </span><a href="in-top-level-transaction.html">T</a></span></span><span class="token punctuation">)</span><span class="token operator">: </span><a href="in-top-level-transaction.html">T</a></div><p class="paragraph">Creates a transaction with the specified <a href="in-top-level-transaction.html">transactionIsolation</a> and <a href="in-top-level-transaction.html">readOnly</a> settings, then calls the <a href="in-top-level-transaction.html">statement</a> block with this transaction as its receiver and returns the result.</p><p class="paragraph"><strong>Note</strong> All changes in this transaction will be committed at the end of the <a href="in-top-level-transaction.html">statement</a> block, even if it is nested and even if <code class="lang-kotlin">DatabaseConfig.useNestedTransactions</code> is set to <code class="lang-kotlin">false</code>.</p><p class="paragraph"><strong>Note</strong> If the database value <a href="in-top-level-transaction.html">db</a> is not set, the value used will be either the last <a href="../org.jetbrains.exposed.sql/-database/index.html">Database</a> instance created or the value associated with the parent transaction (if this function is invoked in an existing transaction).</p><span class="kdoc-tag"><h4 class="">Return</h4><p class="paragraph">The final result of the <a href="in-top-level-transaction.html">statement</a> block.</p></span><h4 class="">Samples</h4>org.jetbrains.exposed.sql.tests.shared.RollbackTransactionTest.testRollbackWithoutSavepoints</div></div>
</div>
      <div class="footer">
        <span class="go-to-top-icon"><a href="#content" id="go-to-top-link"></a></span><span>© 2024 Copyright</span><span class="pull-right"><span>Generated by </span><a href="https://github.com/Kotlin/dokka"><span>dokka</span><span class="padded-icon"></span></a></span>
      </div>
            </div>
        </div>
    </div>
</body>
</html>

